<?php 

class HtmlCtrlHelper{
	
	public static function addUrlParam( $url, $parameters ){
		foreach( $parameters as $param=>$value ){
			$pos = strpos($url, $param);
			if( $pos !== false ){
				$end = strpos($url, "&", $pos);
				if($end>0){
					$index = $pos+1+strlen($param);
					$url = substr_replace( $url, $value, $pos+1+strlen($param), $end-$index );
				}else{ 
					$url = substr_replace( $url, $value, $pos+1+strlen($param) );
				}
			}else
				$url = $url."&$param=$value";
		}
		return $url;
	}
	
	
}

?>